how to find the endpoint given the midpoint